﻿/*
powered by ETW INTERNATIONAL
author:mysteo
date:2013-04-15
for ie7,ie8,ie9,ie10,firefox,chrome...
*/
var quality_trans=new Array();
quality_trans['langauge']='en';
quality_trans['serverpath']='http://usa3.etwun.com//';
quality_trans['div_id']='quality_box';
quality_trans['close_txt']='Close';
quality_trans['subject']='Write a review';
quality_trans['subject_margin_top']='subject_margin_top_en';/*对应CSS中的*/
quality_trans['quality_right_top']='quality_right_top';/*对应CSS中的*/
quality_trans['quality_left_ac']='quality_left_ac';/*对应CSS中的*/
quality_trans['main_title']='I have Some Question';
quality_trans['trans']='Translation mistakes'
quality_trans['trans_title']='Hi, this is my translation, if you find any mistake in the product name or anything wrong in the contents, please feel free to let me know. Thanks for your help! ';
quality_trans['other_ques']='Other problems';
quality_trans['other_title']='Hi, this is my translation, if you find any mistake in the product name or anything wrong in the contents, please feel free to let me know. Thanks for your help! ';
quality_trans['consult']='Inquiry Form';
quality_trans['consult_title']='If you are intrested in our products, you can contact us now!';
quality_trans['Allwidth']=558;
quality_trans['Allheight']=512;
quality_trans['top']=80;
quality_trans['right']=-458;
quality_trans['absright']=454;
quality_trans['left_box']=100;
quality_trans['right_box']=448;
quality_trans['iframe_height']=472;
quality_trans['iframe_src']=quality_trans['serverpath']+'serverFile/chat/quality/translate_quality.php?language='+quality_trans['langauge']+'&type=trans';
quality_trans['iframe_src_other']=quality_trans['serverpath']+'serverFile/chat/quality/translate_quality.php?language='+quality_trans['langauge']+'&type=other';
quality_trans['iframe_src_feedbackform']=quality_trans['serverpath']+'serverFile/chat/quality/translate_quality.php?language='+quality_trans['langauge']+'&type=feedbackform';

var iframe='<iframe id="quality_iframe" width=100% height='+quality_trans['iframe_height']+' scrolling=no frameborder=0></iframe>';
var div=document.createElement('div');
div.setAttribute('id',quality_trans['div_id']);
div.setAttribute('lang',quality_trans['right']);
div.style.cssText='width:'+quality_trans['Allwidth']+'px; height:'+quality_trans['Allheight']+'px; position:fixed; top:'+quality_trans['top']+'px; right:'+quality_trans['right']+'px;z-index:1022;';
function quality_init()
{
	div.innerHTML='<div class="quality_left"><div class="'+quality_trans['quality_left_ac']+'"><div class="write_a_review" id="write_a_review"><a class="'+quality_trans['subject_margin_top']+'" href="#" onclick="quality_open_box();return false;">'+quality_trans['subject']+'</a></div><div class="close_quality_box"><a href="#" onclick=\'close_box_by_id("'+quality_trans['div_id']+'");return false;\'>'+quality_trans['close_txt']+'</a></div></div></div><div id="quality_right" class="quality_right"><div class="'+quality_trans['quality_right_top']+'">'+
'<div class="quality_right_top_left width_40" id="quality_right_top_default"><table class="quality_table_a"><tr><td><a href="#" onclick=\'quality_set_style(this,"quality_right_top_default","quality_right_top_default_other|quality_right_top_default_another","'+quality_trans['iframe_src']+'");return false;\'>'+quality_trans['trans']+'</a></td></tr></table></div>'+
'<div class="quality_right_top_mid width_28" id="quality_right_top_default_other"><table class="quality_table_a"><tr><td><a href="#" onclick=\'quality_set_style(this,"quality_right_top_default_other","quality_right_top_default|quality_right_top_default_another","'+quality_trans['iframe_src_other']+'");return false;\'>'+quality_trans['other_ques']+'</a></td></tr></table></div>'+
'<div class="quality_right_top_right width_28" id="quality_right_top_default_another"><table class="quality_table_a"><tr><td><a href="#" onclick=\'quality_set_style(this,"quality_right_top_default_another","quality_right_top_default_other|quality_right_top_default","'+quality_trans['iframe_src_feedbackform']+'");return false;\'>'+quality_trans['consult']+'</a></td></tr></table></div>'+
'</div><div class="quality_content">'+iframe+'</div></div>';
document.body.appendChild(div);
getelementbyid('quality_right').style.cssText=' margin-left:1px;width:'+quality_trans['right_box']+'px; height:'+quality_trans['Allheight']+'px; float:left; background:#fff; text-align:center;padding:3px 0 0 0; border:1px solid #508300;box-shadow:3px 3px 3px #ccc;-moz-box-shadow:3px 3px 3px #ccc;-webkit-box-shadow:3px 3px 3px #ccc;filter: progid:DXImageTransform.Microsoft.Shadow(color="#CCCCCC", Direction=135, Strength=3);';
	}
//quality_init()
function quality_open_box()
{
	getelementbyid('quality_iframe').setAttribute('src',quality_trans['iframe_src']);
	var ac=window.setInterval(move_to_left,1);
	ac;
	var speed=0;
	function move_to_left()
	{
		var div=getelemetbyid(quality_trans['div_id']);
		var i=div.getAttribute('lang');
		if(i<=0)
		{
			i++;
			speed++;
			div.style.cssText='position:fixed; top:'+quality_trans['top']+'px; right:'+(i+speed)+'px;z-index:1022;';
			div.setAttribute('lang',i+speed);
			}
			else
			{
				getelementbyid('write_a_review').innerHTML='<a href="#" class="'+quality_trans['subject_margin_top']+'"  onclick="quality_close_box();return false;">'+quality_trans['subject']+'</a>';
				window.clearInterval(ac);
				}
		}
	}
function quality_close_box()
{
	var bac=window.setInterval(move_to_right,1);
	bac;
	var speed=0;
	function move_to_right()
	{
		var div=getelemetbyid(quality_trans['div_id']);
		var i=div.getAttribute('lang');
		if(i>-quality_trans['absright'])
		{
			i--;
			speed++;
			div.style.cssText='position:fixed; top:'+quality_trans['top']+'px; right:'+(i-speed)+'px;z-index:1022;';
			div.setAttribute('lang',i-speed);
			}
			else
			{
				
				getelementbyid('write_a_review').innerHTML='<a href="#"  class="'+quality_trans['subject_margin_top']+'"  onclick="quality_open_box();return false;">'+quality_trans['subject']+'</a>';
				getelementbyid('quality_iframe').setAttribute('src','');
				window.clearInterval(bac);
				}
		}
	}
function getelemetbyid(div)
{
	return document.getElementById(div);
	}
function close_box_by_id(div)
{
	var ob=getelementbyid(div);
	ob.parentNode.removeChild(ob);
	}
function set_content_to_html(html,div,timeout)
{
	function init()
	{
		getelemetbyid(div).innerHTML=unescape(html);
		}
	window.setTimeout(init,timeout)
	}
function quality_set_style(thisob,defaultstyle,otherstyle,src)
{
	getelementbyid('quality_iframe').setAttribute('src',src);
	getelementbyid(defaultstyle).style.cssText='background:#fff;';
	thisob.style.cssText=" color:#508300;";
	
	var otherstylediv=otherstyle.split('|');
	var nums=otherstylediv.length;
	for(var i=0;i<nums;i++)
	{
		var parob=getelementbyid(otherstylediv[i]);
		parob.style.cssText='background:#508300; ';
		var alinks=parob.getElementsByTagName('a');
		alinks[0].style.cssText='color:#fff;';
		}
	}
function show_last_num(todiv,max_num,gotopage)
{
	
	 var action;
		function set_to_div_num()
		{
			if(max_num>0)
			{
				max_num=max_num-1;
				getelemetbyid(todiv).innerHTML=max_num;
			}else
			{
				window.clearInterval(action);
				if(gotopage!=undefined)
				{
					window.location.href=gotopage;
					}
				}
			}
	action=window.setInterval(set_to_div_num,1000);
	action;
	}
function quality_goto_page(host,str)
{
	window.location.href=host+str;
	}
